package com.sky.controller.user;

import com.sky.dto.OrdersSubmitDTO;
import com.sky.result.Result;
import com.sky.service.user.OrderService;
import com.sky.vo.OrderSubmitVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user/order")
public class OrderController {
    @Autowired
    private OrderService orderService;
    //查看预计送达时间
    @GetMapping("/getEstimatedDeliveryTime")
    public Result getEstimateDeliveryTime(Long shopId,String customerAddress){
        Result estimateDeliveryTime = orderService.getEstimateDeliveryTime(shopId, customerAddress);
        return estimateDeliveryTime;
    }
    //保存订单信息
    @PostMapping("/submit")
    public Result submit(@RequestBody OrdersSubmitDTO dto){
        OrderSubmitVO submit = orderService.submit(dto);
        return Result.success(submit);
    }
}
